package com.dwf.dominion;

import android.util.Log;
import java.util.Vector;

public class Card{
	public enum Category {
			TYPE_ACTION { public String toString(){ return "Action Cards";}}, 
			TYPE_REACTION { public String toString(){ return "Reaction Cards";}}, 
			TYPE_VICTORY { public String toString(){ return "Victory Cards";}}, 
			TYPE_ATTACK { public String toString(){ return "Attack Cards";}}, 
			TYPE_TREASURE { public String toString(){ return "Treasure Cards";}}, 
			SET_DOMINION { public String toString(){ return "Original Set Cards";}}, 
			SET_INTRIGUE { public String toString(){ return "Intrigue Cards";}}, 
			SET_PROSPERITY { public String toString(){ return "Prosperity Cards";}}, 
			SET_SEASIDE { public String toString(){ return "Seaside Cards";}}, 
			SET_ALCHEMY { public String toString(){ return "Alchemy Cards";}}, 
			COST_2 { public String toString(){ return "2-cost Cards";}}, 
			COST_3 { public String toString(){ return "3-cost Cards";}}, 
			COST_4 { public String toString(){ return "4-cost Cards";}}, 
			COST_5 { public String toString(){ return "5-cost Cards";}}, 
			COST_6 { public String toString(){ return "6-cost Cards";}}, 
			COST_7 { public String toString(){ return "7-cost Cards";}}, 
			COST_8 { public String toString(){ return "8-cost Cards";}}, 
			POTION { public String toString(){ return "Potion-cost Cards";}}, 
			ADDS_COINS { public String toString(){ return "+Coin Cards";}}, 
			ADDS_ACTIONS { public String toString(){ return "+Action Cards";}}, 
			ADDS_NET_ACTIONS { public String toString(){ return "Net +Action Cards";}},
			ADDS_BUYS { public String toString(){ return "+Buy Cards";}}, 
			ADDS_CARDS { public String toString(){ return "+Card Cards";}}, 
			NONE { public String toString(){ return "";}}, 
			SPECIFIC_CARD { public String toString(){ return "";}}};

	public enum Type { ACTION, REACTION, VICTORY, ATTACK, CURSE, TREASURE, UNKNOWN_OR_ERROR, ACTION_ATTACK, ACTION_REACTION, ACTION_VICTORY, TREASURE_VICTORY};
	public enum Set {Promotion, Dominion, Intrigue, Prosperity, Seaside, Alchemy};
	public String name;
	public int cost;
	public boolean potion;
	public Type[] type;
	public Set set;
	public enum State {TEMP_LOCK, TEMP_BAN, NORMAL};
	public State state;
	public int plusBuys;
	public int plusCoins;
	public int plusActions;
	public int plusCards;
		
	public Card(String name, int cost, boolean potion, Set set, Type[] types, int buys, int coins, int actions, int cards)
	{
		this.name = name;
		this.cost = cost;
		this.potion = potion;
		this.set = set;
		this.type = types;
		this.state = Card.State.NORMAL;
		this.plusBuys = buys;
		this.plusCoins = coins;
		this.plusActions = actions;
		this.plusCards = cards;
	}
	
	public boolean isType(Type t)
	{
		for (Type tempType: this.type)
		{
			if (tempType == t)
				return true;
		}
		
		return false;
	}
		
	public boolean isCategory (Category cat)
	{
		switch (cat)
		{
			case TYPE_ACTION:
				if (this.isType(Type.ACTION))
					return true;
				break;
			case TYPE_REACTION:
				if (this.isType(Type.REACTION))
					return true;				
				break;
			case TYPE_VICTORY:
				if (this.isType(Type.VICTORY))
					return true;
				break;
			case TYPE_ATTACK:
				if (this.isType(Type.ATTACK))
					return true;				
				break;
			case TYPE_TREASURE:
				if (this.isType(Type.TREASURE))
					return true;
				break;
			case SET_DOMINION:
				if (this.set == Set.Dominion)
					return true;
				break;
			case SET_INTRIGUE:
				if (this.set == Set.Intrigue)
					return true;				
				break;
			case SET_PROSPERITY:
				if (this.set == Set.Prosperity)
					return true;
				break;
			case SET_SEASIDE:
				if (this.set == Set.Seaside)
					return true;
				break;
			case SET_ALCHEMY:
				if (this.set == Set.Alchemy)
					return true;
				break;
			case COST_2:
				if (this.cost == 2)
					return true;
				break;
			case COST_3:
				if (this.cost == 3)
					return true;
				break;
			case COST_4:
				if (this.cost == 4)
					return true;
				break;
			case COST_5:
				if (this.cost == 5)
					return true;
				break;
			case COST_6:
				if (this.cost == 6)
					return true;
				break;
			case COST_7:
				if (this.cost == 7)
					return true;
				break;
			case COST_8:
				if (this.cost == 8)
					return true;
				break;
			case POTION:
				return this.potion;
			case ADDS_COINS:
				if (this.plusCoins > 0)
					return true;
				break;
			case ADDS_ACTIONS:
				if (this.plusActions > 0)
					return true;				
				break;
			case ADDS_NET_ACTIONS:
				if (this.plusActions > 1)
					return true;
				break;
			case ADDS_BUYS:
				if (this.plusBuys > 0)
					return true;
				break;
			case ADDS_CARDS:
				if (this.plusCards > 0)
					return true;
				break;
			default:
				break;
		}
		
		return false;
	}
	
	public boolean equals(Object obj)
	{
		Card c = (Card)obj;
		return (c.name.equals(this.name));
	}
}

